﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using OpenNETCF.IoC.UI;
using System.Drawing;

namespace ProjectResistance.Shell.Views
{
    public class ViewBase : SmartPart
    {
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            // this assumes we're in a workspace, on MainForm (the whole Parent.Parent thing)
            IBackgroundPaintProvider bgPaintProvider = Parent.Parent as IBackgroundPaintProvider;
            if (bgPaintProvider != null)
            {
                Rectangle rcPaint = e.ClipRectangle;
                // use the parent, since it's the workspace position in the Form we want, not our position in the workspace
                rcPaint.Offset(Parent.Left, Parent.Top);
                bgPaintProvider.PaintBackground(e.Graphics, e.ClipRectangle, rcPaint);
            }
        }
    }
}
